//
//  BaseNavController.swift
//  Weibo T
//
//  Created by mac on 15/12/4.
//  Copyright © 2015年 陈肖坤. All rights reserved.
//

import UIKit

class BaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        if childViewControllers.count != 0 {
            viewController.hidesBottomBarWhenPushed = true
            viewController.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: self, action: "close")
        }
        //调用父类的方法
        super.pushViewController(viewController, animated: animated)
    }
    
    @objc private func close() {
        navigationController?.popViewControllerAnimated(true)
    }

    
}
